app.js ➔ ???   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 42

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 23
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
nc 1
dl 0
loc 42
ccs 23
cts 23
cp 1
crap 1
rs 8.8571
nop 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A app.js ➔ ... ➔ ??? 0 11 1
1
"use strict";
2
3
/* eslint-disable no-unused-vars */
4
5 1
const chai = require('chai');
6 1
const chaiHttp = require('chai-http');
7 1
const server = require('../../app');
8 1
let should = chai.should();
9
10 1
chai.use(chaiHttp);
11
12
/* global describe */
13
/* global it */
14
15 1
describe("test all routes", () => {
16 1
    describe('/GET index', () => {
17 1
        it('it should return object', (done) => {
18 1
            chai.request(server)
19
                .get('/')
20
                .end((err, res) => {
21 1
                    res.should.have.status(200);
22 1
                    res.should.be.json;
0 ignored issues
show
introduced by
The result of the property access to res.should.be.json is not used.
Loading history...
23 1
                    done();
24
                });
25
        });
26
    });
27
28 1
    describe('/GET post', () => {
29 1
        it('it should return post information from Stackoverflow', (done) => {
30 1
            chai.request(server)
31
                .get('/posts/47810715')
32
                .end((err, res) => {
33 1
                    res.should.have.status(200);
34 1
                    res.should.be.json;
0 ignored issues
show
introduced by
The result of the property access to res.should.be.json is not used.
Loading history...
35 1
                    let items = res.body.json.items;
36
37 1
                    items[0].title.should.equal("login template accepting every input");
38 1
                    items[0].link.should.equal("https://stackoverflow.com/q/47810715");
39 1
                    done();
40
                });
41
        });
42
    });
43
44 1
    describe('/GET Error', () => {
45 1
        it('should return error', (done) => {
46 1
            chai.request(server)
47
                .get("/munge")
48
                .end((err, res) => {
49 1
                    res.should.have.status(200);
50 1
                    res.header["content-type"].should.equal("application/json; charset=utf-8");
51 1
                    res.body.should.be.a("object");
52 1
                    done();
53
                });
54
        });
55
    });
56
});
57